package main.java.indi.zyj.c150.recursion;

import java.util.Scanner;

public class _05_UpStair {

    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int i = scanner.nextInt();
        System.out.println(GoStairs(i));


    }


    static int GoStairs(int n){
        if (n == 1) return 1;
        if (n == 2) return 2;
        if (n == 3) return 4;
        return GoStairs(n - 1) + GoStairs(n - 2) + GoStairs(n - 3);
    }

}
